﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Services;
using MvcApplication2.Models;

namespace MvcApplication2.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }

        public ActionResult Modules()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }

        [HttpGet]
        [ActionName("GetLeftMenuItems")]
        public JsonResult GetLeftMenuItems()
        {
            List<LeftMenuItem> items = new List<LeftMenuItem>();
            items.Add(new LeftMenuItem { Title = "First", Url = "first" });
            items.Add(new LeftMenuItem { Title = "Second", Url = "second" });
            items.Add(new LeftMenuItem { Title = "Third", Url = "third" });
            return this.Json(items, JsonRequestBehavior.AllowGet);
        }

        [HttpGet]
        [ActionName("GetCpts")]
        [WebMethod]
        public JsonResult GetCpts(string url)
        {
            var cpts = new List<Cpt>();
            cpts.Add(new Cpt { Id = 1, CptCode = "000d1", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 2, CptCode = "000d2", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 3, CptCode = "000d3", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 4, CptCode = "000d4", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 5, CptCode = "000d5", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 6, CptCode = "000d6", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 7, CptCode = "000d7", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 8, CptCode = "000d8", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 9, CptCode = "000d9", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 10, CptCode = "000d10", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 11, CptCode = "000d11", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 12, CptCode = "000d12", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 13, CptCode = "000d13", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 14, CptCode = "000d14", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 15, CptCode = "000d15", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 16, CptCode = "000d16", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 17, CptCode = "000d17", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 18, CptCode = "000d18", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 19, CptCode = "000d19", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 20, CptCode = "000d20", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 21, CptCode = "000d21", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 22, CptCode = "000d22", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 23, CptCode = "000d23", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 24, CptCode = "000d24", Description = "Lorem Ipsum Description", Url = "first" });
            cpts.Add(new Cpt { Id = 25, CptCode = "000d25", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 26, CptCode = "000d26", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 27, CptCode = "000d27", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 28, CptCode = "000d28", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 29, CptCode = "000d29", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 30, CptCode = "000d30", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 31, CptCode = "000d31", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 32, CptCode = "000d32", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 33, CptCode = "000d33", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 34, CptCode = "000d34", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 35, CptCode = "000d35", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 36, CptCode = "000d36", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 37, CptCode = "000d37", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 38, CptCode = "000d38", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 39, CptCode = "000d39", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 40, CptCode = "000d40", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 41, CptCode = "000d41", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 42, CptCode = "000d42", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 43, CptCode = "000d43", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 44, CptCode = "000d44", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 45, CptCode = "000d45", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 46, CptCode = "000d46", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 47, CptCode = "000d47", Description = "Lorem Ipsum Description", Url = "second" });
            cpts.Add(new Cpt { Id = 48, CptCode = "000d48", Description = "Lorem Ipsum Description", Url = "second" });
            var cptsToReturn = cpts.Where(c => c.Url.ToLower() == url.ToLower()).ToList();

            return this.Json(cptsToReturn, JsonRequestBehavior.AllowGet);
        }

        [HttpGet]
        public JsonResult GetRightMenuItems(int id)
        {
            List<List<RightContentClass>> itemsList = new List<List<RightContentClass>>();
            if (id%2 == 0)
            {
                List<RightContentClass> innerListTaras = new List<RightContentClass>();
                innerListTaras.Add(new RightContentClass { Name = "First Name", Value = "Taras" });
                innerListTaras.Add(new RightContentClass { Name = "Second Name", Value = "Strizhyk" });
                innerListTaras.Add(new RightContentClass { Name = "Full Name", Value = innerListTaras[0].Value + " " + innerListTaras[1].Value });
                innerListTaras.Add(new RightContentClass { Name = "Age", Value = "29" });
                innerListTaras.Add(new RightContentClass { Name = "Birth Date", Value = "11/03/1984" });
                innerListTaras.Add(new RightContentClass { Name = "Height", Value = "178cm" });
                innerListTaras.Add(new RightContentClass { Name = "Weight", Value = "78kg" });
                innerListTaras.Add(new RightContentClass { Name = "Sex", Value = "Male" });
                innerListTaras.Add(new RightContentClass { Name = "Eye color", Value = "Grey" });
                innerListTaras.Add(new RightContentClass { Name = "Hair color", Value = "Blond" });
                itemsList.Add(innerListTaras);

                List<RightContentClass> innerListCat = new List<RightContentClass>();
                innerListCat.Add(new RightContentClass { Name = "Taras's Cat Name", Value = "Casper" });
                innerListCat.Add(new RightContentClass { Name = "Age", Value = "3" });
                innerListCat.Add(new RightContentClass { Name = "Birth Date", Value = "01/05/2011" });
                innerListCat.Add(new RightContentClass { Name = "Weight", Value = "5kg" });
                innerListCat.Add(new RightContentClass { Name = "Sex", Value = "Male" });
                innerListCat.Add(new RightContentClass { Name = "Color", Value = "Grey" });
                innerListCat.Add(new RightContentClass { Name = "Breed", Value = "None" });
                innerListCat.Add(new RightContentClass { Name = "Angry Level", Value = "Very Angry" });
                itemsList.Add(innerListCat);

                List<RightContentClass> innerListRoman = new List<RightContentClass>();
                innerListRoman.Add(new RightContentClass { Name = "First Name", Value = "Roman" });
                innerListRoman.Add(new RightContentClass { Name = "Second Name", Value = "Kurchak" });
                innerListRoman.Add(new RightContentClass { Name = "Full Name", Value = innerListRoman[0].Value + " " + innerListRoman[1].Value });
                innerListRoman.Add(new RightContentClass { Name = "Age", Value = "29" });
                innerListRoman.Add(new RightContentClass { Name = "Birth Date", Value = "01/01/1985" });
                innerListRoman.Add(new RightContentClass { Name = "Height", Value = "197cm" });
                innerListRoman.Add(new RightContentClass { Name = "Weight", Value = "107kg" });
                innerListRoman.Add(new RightContentClass { Name = "Sex", Value = "Male" });
                innerListRoman.Add(new RightContentClass { Name = "Eye color", Value = "Green" });
                innerListRoman.Add(new RightContentClass { Name = "Hair color", Value = "Brunette" });
                itemsList.Add(innerListRoman);

                List<RightContentClass> innerListYarema = new List<RightContentClass>();
                innerListYarema.Add(new RightContentClass { Name = "First Name", Value = "Yarema" });
                innerListYarema.Add(new RightContentClass { Name = "Second Name", Value = "Kipetsky" });
                innerListYarema.Add(new RightContentClass { Name = "Full Name", Value = innerListYarema[0].Value + " " + innerListYarema[1].Value });
                innerListYarema.Add(new RightContentClass { Name = "Age", Value = "19" });
                innerListYarema.Add(new RightContentClass { Name = "Birth Date", Value = "01/07/1994" });
                innerListYarema.Add(new RightContentClass { Name = "Height", Value = "176cm" });
                innerListYarema.Add(new RightContentClass { Name = "Weight", Value = "72kg" });
                innerListYarema.Add(new RightContentClass { Name = "Sex", Value = "Male" });
                innerListYarema.Add(new RightContentClass { Name = "Eye color", Value = "Brown" });
                innerListYarema.Add(new RightContentClass { Name = "Hair color", Value = "Brunette" });
                itemsList.Add(innerListYarema);
            }
            if (id % 2 == 1)
            {
                List<RightContentClass> innerListTaras = new List<RightContentClass>();
                innerListTaras.Add(new RightContentClass { Name = "First Name", Value = "Taras" });
                innerListTaras.Add(new RightContentClass { Name = "Second Name", Value = "Strizhyk" });
                innerListTaras.Add(new RightContentClass { Name = "Full Name", Value = innerListTaras[0].Value + " " + innerListTaras[1].Value });
                innerListTaras.Add(new RightContentClass { Name = "Age", Value = "29" });
                innerListTaras.Add(new RightContentClass { Name = "Birth Date", Value = "11/03/1984" });
                innerListTaras.Add(new RightContentClass { Name = "Height", Value = "178cm" });
                innerListTaras.Add(new RightContentClass { Name = "Weight", Value = "78kg" });
                innerListTaras.Add(new RightContentClass { Name = "Sex", Value = "Male" });
                innerListTaras.Add(new RightContentClass { Name = "Eye color", Value = "Grey" });
                innerListTaras.Add(new RightContentClass { Name = "Hair color", Value = "Blond" });
                itemsList.Add(innerListTaras);

                List<RightContentClass> innerListRoman = new List<RightContentClass>();
                innerListRoman.Add(new RightContentClass { Name = "First Name", Value = "Roman" });
                innerListRoman.Add(new RightContentClass { Name = "Second Name", Value = "Kurchak" });
                innerListRoman.Add(new RightContentClass { Name = "Full Name", Value = innerListRoman[0].Value + " " + innerListRoman[1].Value });
                innerListRoman.Add(new RightContentClass { Name = "Age", Value = "29" });
                innerListRoman.Add(new RightContentClass { Name = "Birth Date", Value = "01/01/1985" });
                innerListRoman.Add(new RightContentClass { Name = "Height", Value = "197cm" });
                innerListRoman.Add(new RightContentClass { Name = "Weight", Value = "107kg" });
                innerListRoman.Add(new RightContentClass { Name = "Sex", Value = "Male" });
                innerListRoman.Add(new RightContentClass { Name = "Eye color", Value = "Green" });
                innerListRoman.Add(new RightContentClass { Name = "Hair color", Value = "Brunette" });
                itemsList.Add(innerListRoman);

                //List<RightContentClass> innerListYarema = new List<RightContentClass>();
                //innerListYarema.Add(new RightContentClass { Name = "First Name", Value = "Yarema" });
                //innerListYarema.Add(new RightContentClass { Name = "Second Name", Value = "Kipetsky" });
                //innerListYarema.Add(new RightContentClass { Name = "Full Name", Value = innerListYarema[0].Value + " " + innerListYarema[1].Value });
                //innerListYarema.Add(new RightContentClass { Name = "Age", Value = "19" });
                //innerListYarema.Add(new RightContentClass { Name = "Birth Date", Value = "01/07/1994" });
                //innerListYarema.Add(new RightContentClass { Name = "Height", Value = "176cm" });
                //innerListYarema.Add(new RightContentClass { Name = "Weight", Value = "72kg" });
                //innerListYarema.Add(new RightContentClass { Name = "Sex", Value = "Male" });
                //innerListYarema.Add(new RightContentClass { Name = "Eye color", Value = "Brown" });
                //innerListYarema.Add(new RightContentClass { Name = "Hair color", Value = "Brunette" });
                //itemsList.Add(innerListYarema);
            }
            //for (int i = 0; i < 5; i++)
            //{
            //    List<RightContentClass> innerList = new List<RightContentClass>();
                
            //    innerList.Add(new RightContentClass { Name = "First Name", Value = "Taras" });
            //    innerList.Add(new RightContentClass { Name = "Second Name", Value = "Strizhyk" });
            //    innerList.Add(new RightContentClass { Name = "Full Name", Value = innerList[0].Value + " " + innerList[1].Value });
            //    innerList.Add(new RightContentClass { Name = "Age", Value = "29" });
            //    innerList.Add(new RightContentClass { Name = "Birth Date", Value = "11/03/1984" });
            //    innerList.Add(new RightContentClass { Name = "Height", Value = "178cm" });
            //    innerList.Add(new RightContentClass { Name = "Weight", Value = "78kg" });
            //    innerList.Add(new RightContentClass { Name = "Sex", Value = "Male" });
            //    innerList.Add(new RightContentClass { Name = "Eye color", Value = "Grey" });
            //    innerList.Add(new RightContentClass { Name = "Hair color", Value = "Blonde" });

            //    itemsList.Add(innerList);
            //}


           
            return Json(itemsList, JsonRequestBehavior.AllowGet);
        }
    }
}